@echo off
chcp 65001 > nul
title Test Login Function

echo ====================================
echo   Test Login Function
echo ====================================
echo.

echo [1] Test direct backend login...
curl -X POST http://localhost:4000/api/auth/login ^
  -H "Content-Type: application/json" ^
  -d "{\"username\":\"admin\",\"password\":\"Admin123\"}" ^
  -v

echo.
echo.
echo [2] Test frontend proxy login...
curl -X POST http://localhost:8102/api/auth/login ^
  -H "Content-Type: application/json" ^
  -d "{\"username\":\"admin\",\"password\":\"Admin123\"}" ^
  -v

echo.
echo.
echo [3] Test with wrong password...
curl -X POST http://localhost:4000/api/auth/login ^
  -H "Content-Type: application/json" ^
  -d "{\"username\":\"admin\",\"password\":\"wrong\"}" ^
  -v

echo.
echo ====================================
echo     Login Test Complete
echo ====================================
echo.
echo Check the backend CMD window for debug logs
echo Look for messages like:
echo - "🔐 登录请求详情"
echo - "📝 解析的凭据"
echo - "✅ 登录验证成功" or "❌ 登录验证失败"
echo.
echo Correct credentials:
echo - Username: admin
echo - Password: Admin123
echo.
pause
